package xyz.jangle.design.flyweight;

public class AppMain23 {

	public static void main(String[] args) {
		
		FlyweightFactory factory = FlyweightFactory.getInstance();
		
		Flyweight flyweight = factory.getFlyweight("1");
		Flyweight flyweight2 = factory.getFlyweight("2");
		Flyweight flyweight3 = factory.getFlyweight("1");
		System.out.println(flyweight==flyweight2);	//flyweight和flyweight2使用不同的实例，返回false
		System.out.println(flyweight==flyweight3);	//flyweight和flyweight3使用相同的实例，返回true
		
		flyweight.operation(123);

	}

}
